Repository navigation
feat(metrics): emit conserver.ingress_list.length observable gauge - #173
Merged
Merged
Conversation
Add an OpenTelemetry observable gauge that samples Redis LLEN for every
configured ingress list and its derived DLQ. Each observation carries:
ingress_list = configured name as in chains.<chain>.ingress_lists
(e.g. "transcribe")
kind = "ingress" | "dlq"
Splitting kind into its own attribute (rather than baking "DLQ:" into the
value) lets monitoring queries filter live vs dead-letter cleanly:
queue_length{kind="dlq"} > 0 instead of regex-matching "^DLQ:".
The callback re-reads chain config on every export tick, so new ingress
lists begin emitting series automatically without a worker restart. The
metric exists alongside the new conserver.dlq.count counter (#171): the
counter records DLQ-write events; the gauge records DLQ-occupancy snapshots.
Implementation:
* New common/lib/queue_metrics.py owns the callback construction.
* New register_observable_gauge() helper in common/lib/metrics.py keeps the
OTel SDK plumbing in one place and matches the existing
increment_counter / record_histogram lazy-init pattern.
* worker_loop() calls register_ingress_list_length_gauge() once per worker
process. With N replicas you get N identical series per dimension;
query-time aggregation (max by ingress_list, kind) collapses them.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an OpenTelemetry observable gauge
conserver.ingress_list.lengththat samples RedisLLENfor every configured ingress list and its derived DLQ. Each observation carries:ingress_list"transcribe") — matches the existingconserver.main_loop.count_vcons_received{ingress_list=…}counter dimensionkind"ingress"for the live queue,"dlq"for the derived dead-letter queueSplitting
kindinto its own attribute (rather than bakingDLQ:into the value) lets queries filter live vs dead-letter cleanly:conserver.ingress_list.length{kind="dlq"} > 0instead of regex-matching^DLQ:in a label value.The callback re-reads chain config on every export tick, so new ingress lists begin emitting series automatically — no worker restart required.
Pairs with the
conserver.dlq.countcounter from #171: counter records the event of moving a vCon to DLQ; gauge records the state of how many are sitting there right now.Implementation
common/lib/queue_metrics.pyowns the callback construction (one observation per(ingress_list, kind)combination).register_observable_gauge()helper incommon/lib/metrics.pykeeps OTel SDK plumbing in one place and matches the existingincrement_counter/record_histogramlazy-init pattern.worker_loop()callsregister_ingress_list_length_gauge()once per worker process, immediately after the Redis client +VconQueueare initialized.max by (ingress_list, kind)) collapses them.LLENfailures (transient Redis errors) skip that series only — the export tick still publishes the series that succeeded.Test plan
common/tests/test_queue_metrics.pycovers the callback in isolation (no OTel SDK):(ingress_list, kind)with correct valuesingress_listattribute value is the bare configured name for BOTH the live and DLQ observationsLLENfailure skips that series, others still emitcommon/tests/test_dlq_expiry.py,test_queue_dlq_counter.py,test_parallel_processing.pystill passconserver.ingress_list.lengthappears with the expected dimensions🤖 Generated with Claude Code